package com.yupi.yuoj.judge.codesandbox.impl;

import com.yupi.yuoj.judge.codesandbox.CodeSandBox;
import com.yupi.yuoj.judge.codesandbox.model.ExecuteCodeRequest;
import com.yupi.yuoj.judge.codesandbox.model.ExecuteCodeResponse;
import com.yupi.yuoj.judge.codesandbox.model.JudgeInfo;
import com.yupi.yuoj.model.enums.QuestionSubmitStatusEnum;
import org.springframework.stereotype.Service;

/**
 * @author 86134
 * @version 1.0
 * @description TODO
 * @date 2024/6/24 22:27
 */
@Service
public class ExampleCodeSandbox implements CodeSandBox {
    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest executeCodeRequest) {
        System.out.println("示例代码沙箱");

        ExecuteCodeResponse<Integer> executeCodeResponse = new ExecuteCodeResponse<>();
        JudgeInfo judgeInfo = new JudgeInfo();
        judgeInfo.setMemory(1000L);
        judgeInfo.setTime(1000L);
        judgeInfo.setMessage("执行成功");
        executeCodeResponse.setJudgeInfo(judgeInfo);
        executeCodeResponse.setMessage("没有问题");
        executeCodeResponse.setStatus(QuestionSubmitStatusEnum.SUCCESS.getValue());
        executeCodeResponse.setOutputList(executeCodeRequest.getInputList());

        return executeCodeResponse;
    }
}
